<?php 

/**
 * Joomla! 1.5 component arts_curriculum
 * @package    arts_curriculum
 * @subpackage
 * @author     Chris Borkowski {@link http://www.guggenheim.org}
 * @author     Created on 31-August-2009
 * @author     Modified on 12-January-2010
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );


jimport('joomla.application.component.view');
 /**
  * @package Arts_curriculum
  */
  class Arts_curriculumViewItem extends JView
  {
  		function display($tpl = null)
 	    {
  			global $mainframe, $options;
 
			$pathway = &$mainframe->getPathway();
			$document = & JFactory::getDocument();
  			$model = &$this->getModel();
  			$params = &$mainframe->getParams();
  			
  			
  			//get the category data, so we can use it also here
		  	//$category =& $model->getCat();
		 	
  
			// Get the parameters of the active menu item
			$menus = &JSite::getMenu();
			$menu = $menus->getActive();
			$item =& $this->get('data');
			
			//load & process system content plugins
			$dispatcher = & JDispatcher::getInstance();
			JPluginHelper::importPlugin('content');
			$results = $dispatcher->trigger('onPrepareContent', array (& $item, & $params, 1));
			$item->main_body = JHTML::_('content.prepare', $item->main_body);
 			$item->view_n_dis =JHTML::_('content.prepare', $item->view_n_dis);
 			$item->further_reading =JHTML::_('content.prepare', $item->further_reading);
 			
 			$over_title = 'Arts Curriculum';
 			
 			// Set the document page title
  			// because the application sets a default page title, we need to get it
  			// right from the menu item itself
  			if (is_object( $menu ) && isset($menu->query['view']) && $menu->query['view'] == 'item' && isset($menu->query['id']) && $menu->query['id'] == $item->id) {
  				$menu_params = new JParameter( $menu->params );
 		    	 if (!$menu_params->get( 'page_title')) {
 				 $params->set('page_title', $over_title);
  					}
  				} 
  				else 
  				{
  				$params->set('page_title', $over_title);
  				}
			
			$document->setTitle( $params->get( 'page_title' ) );
			
			// add some css
            $document =& JFactory::getDocument();
            $document->addStyleSheet($this->baseurl.'/components/com_arts_curriculum/css/ac_front.css');
			//$document->addStyleSheet($this->baseurl.'/components/com_arts_curriculum/js/jquery.tabs.css');
			//$document->addStyleSheet($this->baseurl.'/components/com_arts_curriculum/js/jquery.tabs-ie.css');
			
			// add the java script
// 			$js = '<script src="/components/com_arts_curriculum/js/jquery-1.1.3.1.pack.js" type="text/javascript"></script>';
//         	$js.= '<script src="/components/com_arts_curriculum/js/jquery.history_remote.pack.js" type="text/javascript"></script>';
//         	$js.= '<script src="/components/com_arts_curriculum/js/jquery.tabs.pack.js" type="text/javascript"></script>';
//         	$js.= '<script type="text/javascript">';
//            	$js.= ' $(function() { ';
//             $js.= ' $(\'#container-1\').tabs(); ';          
//             $js.= ' });';
//         	$js.= '</script>';

			//$document->addCustomTag($js);
			
 			//set breadcrumbs
 			if (isset( $menu ) && isset($menu->query['view']) && $menu->query['view'] != 'item'){
 			$pathway->addItem($over_title, '');
 			}
 				 		
 		
			 $this->assignRef('params', $params);
			 $this->assignRef('category', $category);
 			 $this->assignRef('item', $item);
  
  			 parent::display($tpl);
 		 }
  }